package router

import (
	"tosServer/internal/app/dav"
	"tosServer/internal/middleware"

	"github.com/spf13/viper"
)

func (r *Route) dav() {
	group := r.httpRouter.Group(viper.Get("dav.prefix").(string)).Use(middleware.DavAuth)
	{
		group.Handle("PROPFIND", "/*path", (&dav.Dav{}).Dir)
		group.Handle("MKCOL", "/*path", (&dav.Dav{}).Dir)
		group.Handle("LOCK", "/*path", (&dav.Dav{}).Dir)
		group.Handle("UNLOCK", "/*path", (&dav.Dav{}).Dir)
		group.Handle("PROPPATCH", "/*path", (&dav.Dav{}).Dir)
		group.Handle("COPY", "/*path", (&dav.Dav{}).Dir)
		group.Handle("MOVE", "/*path", (&dav.Dav{}).Dir)
		group.Any("/*path", (&dav.Dav{}).Dir)
	}
}
